package controller.v2;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import dao.v2.MemberCartVOMapper;
import model.MemberLevelItemVO;
import model.MemberVO;
import service.v2.ConfigService;
import service.v2.GoodTempService;
import service.v2.MemberCartServise;
import service.v2.MemberItemService;
import service.v2.MemberLevelItemService;
import service.v2.MemberService;
import service.v2.MoneyService;
import service.v2.OrderService;
import service.v2.PayService;
import service.v2.SplitService;
import util.NumberUtil;
import util.PackageUtil;
import util.PropertieUtil;
import util.StringUtil;

@Controller
public class TempRechargeTicketController {
	
	

	@Autowired
	private MoneyService moneyService;
	@Autowired
	private PayService payService;
	@Autowired
	private MemberLevelItemService memberLevelItemService;
	@Autowired
	private MemberService memberService;
	@Autowired
	private ConfigService configService;
	@Autowired
	private OrderService orderService;
	@Autowired
	private SplitService splitService;
	@Autowired
	private MemberCartVOMapper memberCartVOMapper;
	@Autowired
	private GoodTempService goodTempService;
	@Autowired
	private MemberCartServise memberCartServise;
	@Autowired
	private MemberItemService memberItemService;
	
	/**
	 * 兑换券充值 余额
	 * @param pwd 接口访问token
	 * @param member_id
	 * @throws Exception 
	 */
	@ResponseBody
	@RequestMapping(value="/rechargeTicketCashPay",method=RequestMethod.POST)
	public Object rechargeTicketCashPay(String member_id, HttpServletRequest request, HttpServletResponse response
			,MemberVO memberVO, String ticket ,String rate, String pay_pwd, String type, String pwd) throws Exception{
		
//		if(!configService.loadConfig("INTERFACE_TOKEN").equals(pwd) || member_id == null || "".equals(member_id) || rate == null || "".equals(rate)|| ticket == null || "".equals(ticket)){
//			return PackageUtil.packageParams(403,"failed","",""); 
//		}
//		//提货券充值 生成日志
//		String conn_no = payService.insertMemberTicket(null,member_id, ticket, rate, 1, PropertieUtil.loadPropertie("partner_level"));
//		//分润
//		memberVO = memberService.getAllInfoById(member_id); 
//		splitService.split(member_id, memberVO.getLevel(), 1, ticket, rate, conn_no,  0+"", 1+"");
		
		return PackageUtil.packageParams(200,"successs","",""); 
	}
}
